#include <ConnectionBroker/server/WebSocketServer.h>
#include <ConnectionBroker/server/WebSocketServerHandler.h>
#include <websocketpp.hpp>

using namespace ConnectionBroker;

WebSocketServerHandler::WebSocketServerHandler(WebSocketServer* pServer)
: handler(), mServer(pServer)
{
}

WebSocketServerHandler::~WebSocketServerHandler()
{
}

void WebSocketServerHandler::on_open(connection_ptr con) 
{
   mServer->webSocketClientFactory(con);
}

void WebSocketServerHandler::on_close(connection_ptr con) 
{
   mServer->webSocketClientRemove(con);
}

void WebSocketServerHandler::on_message(connection_ptr con, message_ptr msg) 
{
   mServer->onMessage(con, msg->get_payload());
}

